#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 5e5 + 10;
ll a[N], t[N];
int n, q;

int lowbit(int x) { return x & -x; }

void update(int k, ll x) {
	for (int i = k; i <= n; i += lowbit(i)) t[i] += x;
}

ll getsum(int k) {
	ll res = 0;
	for (int i = k; i > 0; i -= lowbit(i)) res += t[i];
	return res;
}

void solve() {
	cin >> n >> q;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) update(i, a[i]);
	while (q--) {
		int op; cin >> op;
		if (op == 1) {
			ll k, v; cin >> k >> v;
			update(k, v);
		}
		else {
			ll l, r; cin >> l >> r;
			cout << getsum(r) - getsum(l - 1) << '\n';
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	solve();
	return 0;
}